package com.wjw.action;

import com.opensymphony.xwork2.ActionSupport;
import com.wjw.model.Dept;
import com.wjw.utils.HibernateUtil;
import org.hibernate.Query;
import org.hibernate.Session;

import java.util.List;

public class deptAction extends ActionSupport {

    private List<Dept> deptList;


    public String toShowDept(){
        Session session= HibernateUtil.getSession();
        //hql用的实体类类名不是sql
        String hql="from Dept";
        Query query=session.createQuery(hql);
        deptList=query.list();
        return "showDept";
    }

    public List<Dept> getDeptList() {
        return deptList;
    }

    public void setDeptList(List<Dept> deptList) {
        this.deptList = deptList;
    }
}
